/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package de.blitzcoder.cddatabase.gui.trackeditor;

import de.blitzcoder.cddatabase.data.Track;
import java.awt.Color;
import java.awt.Component;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellRenderer;

/**
 *
 * @author blitzcoder
 */
public class TrackTableCellRenderer implements TableCellRenderer {

    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        JLabel l = new JLabel();
        switch (column) {
            case 0:
                l = new JLabel(value.toString()); // Should be an Integer
                break;
            case 1:
            case 3:
                l = new JLabel((String) value);
                break;
            case 2:
                if (value == Track.NO_ARTIST) {
                    l = new JLabel("Kein");
                    l.setForeground(Color.GRAY);
                    break;
                } else {
                    l = new JLabel((String) value);
                    break;
                }
            }

        return l;
        
    }
}